package com.xwj.xuthread.spring.nacos;

import com.alibaba.nacos.api.config.annotation.NacosConfigurationProperties;
import com.xwj.xuthread.spring.core.ThreadPoolConfig;
import jakarta.annotation.PostConstruct;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Description TODO
 * @Author xwj
 * @Date 2025/8/24
 */
@RefreshScope
@ConfigurationProperties()
@Component
@Data
public class ThreadPoolNacosConfig {

    private MonitorConfig monitor;

    private List<ThreadPoolConfig> threadPools;


    @PostConstruct
    public void printConfig() {
        System.out.println("threadPools: " + threadPools);  // 查看是否为 null
        System.out.println("完整配置: " + this);  // 查看整个对象的绑定情况
    }
    @Data
    public static class MonitorConfig {
        private int interval;//s
        private int activeRate;//最大活跃度【1,100】
        private int capacityRate;//队列占比
        private int rejectCount;//拒绝次数
    }
}
